package com.kefan.reptilemanagement.controller;


import com.baomidou.mybatisplus.extension.api.R;
import com.kefan.reptilemanagement.common.entities.ResultBody;
import com.kefan.reptilemanagement.common.entities.Spider;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author sjj
 * @since 2024-05-03
 */
@RestController
@RequestMapping("/spider")
public class SpiderController extends BaseController {

    @PostMapping("/add")
    public ResultBody addAndCompeleteApplication(@RequestBody Spider spider)
    {
        return ResultBody.success(spiderService.addAndCompeleteApplication(spider));
    }
    @GetMapping("/list")
    public ResultBody getList(@RequestParam(value = "name",required = false) String name,@RequestParam(value = "status",required = false) Integer status,@RequestParam(value = "tech_id",required = false) Long tech_id)
    {
        return ResultBody.success(spiderService.getList(name, status, tech_id));
    }
    @GetMapping("/currentlist")
    public ResultBody getCurrentSpiderList()
    {
        return ResultBody.success(spiderService.getCurrentSpiderList());
    }
    @DeleteMapping("/delete")
    public ResultBody delete(@RequestParam("id") Long id)
    {
        return ResultBody.success(spiderService.delete(id));
    }
    @PutMapping("/update")
    public ResultBody change(@RequestBody Spider spider)
    {
        return ResultBody.success(spiderService.change(spider));
    }
    @PostMapping("/upload")
    public ResultBody upload(@RequestParam("id") Long id,@RequestParam("content") String content)
    {
        return ResultBody.success(spiderService.upload(id, content));
    }
}

